package lab02.test33;

import java.util.*;

public class Test33 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<String> list = new ArrayList<String>();
        System.out.println("请输入若干个单词.(单词之间用空格隔开)");
        String s = " ";
        s = sc.nextLine();                       //从键盘输入单词

        String[] result = s.split(" ");
        for(int i = 0 ; i < result.length; i++) {                //将单词依次放入list集合中
            list.add(result[i]);
        }

        Collections.sort(list);      //运用对list集合操作的工具类Collertions进行排序
        for(int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
}
